<template>
	<view class="content">
		<view class="form-block" style="border-radius:30rpx 30rpx 0 0 ;">
			<view class="form-title">填写求职意向</view>
			<view class="sub-title">不同的求职意向，推荐的职位也会不同</view>
			<view class="form-item">
				<view class="form-label">期望职位</view>
				<view class="form-content">
					<input v-model="form.postNames" maxlength="30" type="text" placeholder="请选择期望职位"
						placeholder-class="inputPlaceholder" disabled="true" @click="chooseJobCategory"
						class="form-ctrl" />
					<view class="iconfont icon-gengduo1 arrow"></view>
				</view>
			</view>
			<view class="form-item">
				<view class="form-label">职位分类</view>
				<view class="form-content">
					<picker class="form-ctrl" :range="type"
						range-key="value" :value="form.recruitType-1" @change="bindType">
						{{type[form.recruitType-1]['value']}}
					</picker>
					<view class="iconfont icon-gengduo1 arrow"></view>
				</view>
			</view>
			<view class="btn" @click="handleSave">一键匹配</view>
		</view>
	</view>
</template>

<script>
	import {getSalaryData} from '@/util/util.js'
	import {validate} from '@/util/validate.js'
	export default {
		data() {
			return {
				form: {
					post:null,
					recruitType:1,
					postNames:'',
				},
				rules: {
					post: {
						name:'期望职位',
						required:true
					}
				},
				//全职兼职选择
				type:[{id:1,value:'全职'},{id:2,value:'兼职'}],
				typeIndex:0,
			}
		},
		methods: {
			bindType(e) {
				this.form.recruitType = e.detail.value*1+1
			},
			chooseJobCategory() {
				uni.navigateTo({
					url: '/page_other/job_category/index?max=1'
				})
			},
			handleSave(){
				if(validate(this.form,this.rules)){
					let form={recruitType:this.form.recruitType,jobType:this.form.post}
					uni.navigateTo({
						url:`/page_other/sweep_matching/matching?recruitType=${this.form.recruitType}&jobType=${this.form.post}`
					})
				}
			},
		},
		onLoad(e) {
			uni.$on('getJobCategory', (e)=> {
				this.form.post = e[0].id
				this.form.postNames = e[0].jobTitle;
			})
		}

	}
</script>

<style lang="scss">
	page {
		background: #fff;
	}

	.content {
		width: 100%;

		.btn {
			width: 350rpx;
			height: 80rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			background: #FF7626;
			color: #fff;
			font-size: 28rpx;
			border-radius: 40rpx;
			margin: 0 auto;
			margin-top: 30rpx;
		}

		.user-photo-block {
			width: 100%;
			height: 450rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.user-photo {
				width: 180rpx;
				height: 180rpx;
				border-radius: 50%;
			}
		}

		.form-block {
			width: 100%;
			box-shadow: 0 0 10px 0 #efefef;
			background: #fff;
			padding: 30rpx;

			.form-title {
				font-size: 36rpx;
				font-weight: bold;
			}

			.sub-title {
				font-size: 26rpx;
				color: #999;
			}

			.form-item {
				display: flex;
				flex-direction: column;
				border-bottom: 1px solid #efefef;
				padding-top: 30rpx;

				.form-label {
					font-size: 28rpx;
					color: #999;
				}

				.form-content {
					display: flex;
					flex-direction: row;
					align-items: center;

					.form-ctrl {
						height: 100rpx;
						line-height: 100rpx;
						flex-grow: 1;
					}

					.arrow {
						flex-grow: 0;
						color: #999;
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>
